<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Upload extends CI_Controller {
	public function __construct(){
		parent::__construct();
		$this->load->library('result');
	}
	
	public function index(){
		$this->load->view('upload');
	}
	
	public function do_upload(){
		$config['upload_path']='./upload/';
		$config['allowed_types']='gif|png|jpg|xml';
		$config['max_size']=1024*10;
		
		$this->load->library('upload',$config);
		if($this->upload->do_upload('userfile')){
			$this->result->setData(0,print_r($this->upload->data(),true),null);
		}else{
			$this->result->setData(1,$this->upload->display_errors(),null);
		}
		$this->result->output();
	}
}
